home *** CD-ROM | disk | FTP | other *** search
/ Best of Shareware / Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso / mac / ZIPPED / DOS / GRAPHICS / POVSRC.ZIP / MACHINE.ZIP / MAC.SIT / ImageCompression.h < prev    next >
Text File  |  1992-04-24  |  26KB  |  621 lines

  1.  
  2. /************************************************************
  3.  
  4. Created: Tuesday, August 13, 1991 at 4:25 PM
  5.  ImageCompression.h
  6.  C Interface to the Macintosh Libraries
  7.  
  8.  
  9.  Copyright Apple Computer, Inc. 1991
  10.  All rights reserved
  11.  
  12. ************************************************************/
  13.  
  14.  
  15. #ifndef __IMAGECOMPRESSION__
  16. #define __IMAGECOMPRESSION__
  17.  
  18. #ifndef __QUICKDRAW__
  19. #include <QuickDraw.h>
  20. #endif
  21.  
  22. #ifndef __QDOFFSCREEN__
  23. #include <QDOffscreen.h>
  24. #endif
  25.  
  26. #ifndef __TYPES__
  27. #include <Types.h>
  28. #endif
  29.  
  30. #ifndef __COMPONENTS__
  31. #include "Components.h"
  32. #endif
  33.  
  34. #ifndef __STANDARDFILE__
  35. #include <StandardFile.h>
  36. #endif
  37.  
  38.  
  39. enum {
  40.  
  41.  
  42. #define gestaltCompressionMgr 'icmp'
  43.  
  44. /* These are the bits that are set in the Component flags, and also in the codecInfo struct. */
  45.  
  46. #define codecInfoDoes1 (1L<<0)                        /* codec can work with 1-bit pixels */
  47. #define codecInfoDoes2 (1L<<1)                        /* codec can work with 2-bit pixels */
  48. #define codecInfoDoes4 (1L<<2)                        /* codec can work with 4-bit pixels */
  49. #define codecInfoDoes8 (1L<<3)                        /* codec can work with 8-bit pixels */
  50. #define codecInfoDoes16 (1L<<4)                        /* codec can work with 16-bit pixels */
  51. #define codecInfoDoes32 (1L<<5)                        /* codec can work with 32-bit pixels */
  52. #define codecInfoDoesDither (1L<<6)                    /* codec can do ditherMode */
  53. #define codecInfoDoesStretch (1L<<7)                /* codec can stretch to arbitrary sizes */
  54. #define codecInfoDoesShrink (1L<<8)                    /* codec can shrink to arbitrary sizes */
  55. #define codecInfoDoesMask (1L<<9)                    /* codec can mask to clipping regions */
  56.  
  57. #define codecInfoDoesTemporal (1L<<10)                /* codec can handle temporal redundancy */
  58.  
  59. #define codecInfoDoesDouble (1L<<11)                /* codec can stretch to double size exactly */
  60. #define codecInfoDoesQuad (1L<<12)                    /* codec can stretch to quadruple size exactly */
  61. #define codecInfoDoesHalf (1L<<13)                    /* codec can shrink to half size */
  62. #define codecInfoDoesQuarter (1L<<14)                /* codec can shrink to quarter size */
  63.  
  64. #define codecInfoDoesRotate (1L<<15)                /* codec can rotate on decompress */
  65. #define codecInfoDoesHorizFlip (1L<<16)                /* codec can flip horizontally on decompress */
  66. #define codecInfoDoesVertFlip (1L<<17)                /* codec can flip vertically on decompress */
  67. #define codecInfoDoesSkew (1L<<18)                    /* codec can skew on decompress */
  68. #define codecInfoDoesBlend (1L<<19)                    /* codec can blend on decompress */
  69. #define codecInfoDoesWarp (1L<<20)                    /* codec can warp arbitrarily on decompress */
  70. #define codecInfoDoesRecompress (1L<<21)            /* codec can recompress image without accumulating errors */
  71. #define    codecInfoDoesSpool            (1L<<22)    /* codec can spool image data */
  72.  
  73. #define codecInfoDepth1 (1L<<0)                        /* compressed data at 1 bpp depth available */
  74. #define codecInfoDepth2 (1L<<1)                        /* compressed data at 2 bpp depth available */
  75. #define codecInfoDepth4 (1L<<2)                        /* compressed data at 4 bpp depth available */
  76. #define codecInfoDepth8 (1L<<3)                        /* compressed data at 8 bpp depth available */
  77. #define codecInfoDepth16 (1L<<4)                    /* compressed data at 16 bpp depth available */
  78. #define codecInfoDepth32 (1L<<5)                    /* compressed data at 32 bpp depth available */
  79. #define codecInfoDepth24 (1L<<6)                    /* compressed data at 24 bpp depth available */
  80. #define codecInfoDepth33 (1L<<7)                    /* compressed data at 1 bpp monochrome depth  available */
  81. #define codecInfoDepth34 (1L<<8)                    /* compressed data at 2 bpp grayscale depth available */
  82. #define codecInfoDepth36 (1L<<9)                    /* compressed data at 4 bpp grayscale depth available */
  83. #define codecInfoDepth40 (1L<<10)                    /* compressed data at 8 bpp grayscale depth available */
  84. #define codecInfoStoresClut (1L<<11)                /* compressed data can have custom cluts */
  85. #define    codecInfoDoesLossless        (1L<<12)        /* compressed data can be stored in lossless format */
  86.  
  87. #define codecFlagUseImageBuffer (1L<<0)                /* (input) allocate buffer for whole image on decompress sequence */
  88. #define codecFlagUseScreenBuffer (1L<<1)            /* (input) allocate buffer for screen on decompress sequence for faster updates */
  89. #define codecFlagUpdatePrevious (1L<<2)                /* (input) udate previous buffer on compress sequence */
  90. #define codecFlagNoScreenUpdate (1L<<3)                /* (input) dont update screen, but do update image buffer if allocated */
  91. #define codecFlagWasCompressed (1L<<4)                /* (input) hint to compressor that image was previously compressed */
  92. #define codecFlagDontOffscreen (1L<<5)                /* return error instead of automatically going offscreen */
  93. #define codecFlagUpdatePreviousComp (1L<<6)            /* (input) udate previous buffer on compress sequence */
  94. #define codecFlagForceKeyFrame (1L<<7)                /* when sent to CompressSequenceFrame, forces that frame to be a key frame */
  95. #define    codecFlagOnlyScreenUpdate    (1L<<8)        /* (input) only update screen from */
  96. #define    codecFlagLiveGrab            (1L<<9)        /* (input) data being compressed is from live source (speed is critical) */
  97.  
  98.  
  99.  
  100. #define    codecFlagUsedNewImageBuffer    (1L<<14)    /* (output) indicates that image buffer was first used on this decompress sequence */
  101. #define codecFlagUsedImageBuffer (1L<<15)            /* (output) indicates that image buffer was used on this decompress sequence */
  102.  
  103. #define codecErr -8960                                /* the codec returned an error */
  104. #define noCodecErr -8961                            /* the specified codec could not be found */
  105. #define codecUnimpErr -8962                            /* this feature is not implemented by the specified codec */
  106. #define codecSizeErr -8963
  107. #define codecScreenBufErr -8964                        /* the screen buffer could not be allocated */
  108. #define codecImageBufErr -8965                        /* the image buffer could not be allocated */
  109. #define codecSpoolErr -8966                            /* the compressed data must be in memory (spooling did not work) */
  110. #define codecAbortErr -8967                            /* the operation was aborted by the progress proc */
  111. #define codecWouldOffscreenErr -8968                /* an offscreen access would have been used, but wasn't allowed because codecFlagDontOffscreen was set */
  112. #define codecBadDataErr -8969                        /* compressed data was found to have inconsistencies */
  113. #define codecDataVersErr -8970                        /* compressed data was of a format version that codec couldn't handle */
  114. #define    codecConditionErr    -8972                    /* codec can not do requested operation */
  115. #define    codecOpenErr        -8973                    /* the codec  could not be opened */
  116.  
  117.  
  118.  codecMinimumDataSize = 32768                        /* The minimum data size for spooling in or out data */
  119.  
  120.  
  121. #define compressorComponentType 'imco'                /* the type for "Components" which compress images */
  122. #define decompressorComponentType 'imdc'            /* the type for "Components" which decompress images */
  123. };
  124.  
  125. typedef Component CompressorComponent;                /* a Component which compresses images */
  126. typedef Component DecompressorComponent;            /* a Component which decompresses images */
  127. typedef Component CodecComponent;                    /* a Component which decompresses or compresses images */
  128.  
  129.  
  130.  
  131.  
  132. #define anyCodec ((CodecComponent)0)                /* take first working codec of given type */
  133. #define bestSpeedCodec ((CodecComponent)-1)            /* take fastest codec of given type */
  134. #define bestFidelityCodec ((CodecComponent)-2)        /* take codec which is most accurate*/
  135. #define bestCompressionCodec ((CodecComponent)-3)    /* take codec of given type that is most accurate */
  136.  
  137.  
  138. typedef short sBoolean;                                /* to make sure stack frames are right */
  139.  
  140. typedef long CodecType;                                /* type descriptor for codecs i.e: 'appl','jpeg','rle ' */
  141.  
  142. typedef unsigned short CodecFlags;                    /* flags for codec manager calls */
  143.  
  144. typedef unsigned long CodecQ;
  145.  
  146.  
  147.  
  148.  
  149. #define codecLosslessQuality 0x400L
  150. #define codecMaxQuality 0x3FFL
  151. #define codecMinQuality 0x000L
  152. #define codecLowQuality 0x100L
  153. #define codecNormalQuality 0x200L
  154. #define codecHighQuality 0x300L
  155.  
  156. typedef pascal OSErr (*DataProcPtr)(Ptr *dataP,long bytesNeeded,long refCon);  
  157. typedef pascal OSErr (*FlushProcPtr)(Ptr data,long bytesAdded,long refCon);
  158.  
  159.  
  160.  
  161.  
  162. #define codecCompletionSource (1<<0)        /* asynchronous codec is done with source data */
  163. #define codecCompletionDest (1<<1)            /* asynchronous codec is done with destination data */
  164.  
  165. typedef pascal void (*CompletionProcPtr)(OSErr result,short flags,long refCon);
  166.  
  167. enum {
  168.  
  169.  codecProgressOpen = 0,
  170.  codecProgressUpdatePercent = 1,
  171.  codecProgressClose = 2
  172. };
  173.  
  174. typedef pascal OSErr (*ProgressProcPtr)(short message,Fixed completeness,long refCon);
  175.  
  176. typedef long ImageSequence;
  177.  
  178. struct ProgressProcRecord {
  179.  ProgressProcPtr progressProc;
  180.  long progressRefCon;
  181. };
  182.  
  183. typedef struct ProgressProcRecord ProgressProcRecord;
  184. typedef ProgressProcRecord *ProgressProcRecordPtr;
  185.  
  186. struct CompletionProcRecord {
  187.  CompletionProcPtr completionProc;
  188.  long completionRefCon;
  189. };
  190.  
  191. typedef struct CompletionProcRecord CompletionProcRecord;
  192. typedef CompletionProcRecord *CompletionProcRecordPtr;
  193.  
  194. struct DataProcRecord {
  195.  DataProcPtr dataProc;
  196.  long dataRefCon;
  197. };
  198.  
  199. typedef struct DataProcRecord DataProcRecord;
  200. typedef DataProcRecord *DataProcRecordPtr;
  201.  
  202. struct FlushProcRecord {
  203.  FlushProcPtr flushProc;
  204.  long flushRefCon;
  205. };
  206.  
  207. typedef struct FlushProcRecord FlushProcRecord;
  208. typedef FlushProcRecord *FlushProcRecordPtr;
  209.  
  210. /* 
  211.     The ImageDescription is private data which is produced when an image or sequence 
  212.     is compressed. It fully describes the format of the compressed data.*/
  213.  
  214. struct ImageDescription {
  215.  long idSize;                                        /* total size of ImageDescription including extra data ( CLUTs and other per sequence data */
  216.  CodecType cType;                                    /* what kind of codec compressed this data */
  217.  long resvd1;                                        /* reserved for apple use */
  218.  short resvd2;                                        /* reserved for apple use */
  219.  short dataRefIndex;                                /* set to zero */
  220.  short version;                                        /* which version is this data */
  221.  short revisionLevel;                                /* what version of that codec did this */
  222.  long vendor;                                        /* whose  codec compressed this data */
  223.  CodecQ temporalQuality;                            /* what was the temporal quality factor          */
  224.  CodecQ spatialQuality;                                /* what was the spatial quality factor          */
  225.  short width;                                        /* how many pixels wide is this data */
  226.  short height;                                        /* how many pixels high is this data */
  227.  Fixed hRes;                                        /* horizontal resolution */
  228.  Fixed vRes;                                        /* vertical resolution */
  229.  long dataSize;                                        /* if known, the size of data for this image descriptor */
  230.  short frameCount;                                    /* number of frames this description applies to */
  231.  char name[32];                                        /* name of codec ( in case not installed ) */
  232.  short depth;                                        /* what depth is this data (1-32) or ( 33-40 grayscale ) */
  233.  short clutID;                                        /* clut id or if 0 clut follows  or -1 if no clut */
  234. };
  235.  
  236. typedef struct ImageDescription ImageDescription;
  237. typedef ImageDescription *ImageDescriptionPtr, **ImageDescriptionHandle;
  238.  
  239. /* 
  240.     The CodecInfo is the information returned as the codecInfo struct by a codec Component
  241.     to the codec manager or to the caller. It is specific to the particular codec
  242.     implementation and not to the codec type.*/
  243.  
  244. struct CodecInfo {
  245.  char typeName[32];                                    /* name of the codec type i.e.: 'Apple Image Compression' */
  246.  short version;                                        /* version of the codec data that this codec knows about */
  247.  short revisionLevel;                                /* revision level of this codec i.e: 0x00010001 (1.0.1) */
  248.  long vendor;                                        /* Maker of this codec i.e: 'appl' */
  249.  long decompressFlags;                                /* codecInfo flags for decompression capabilities */
  250.  long compressFlags;                                /* codecInfo flags for compression capabilities */
  251.  long formatFlags;                                    /* codecInfo flags for compression format details */
  252.  unsigned char compressionAccuracy;                    /* measure (1-255) of accuracy of this codec for compress (0 if unknown) */
  253.  unsigned char decompressionAccuracy;                /* measure (1-255) of accuracy of this codec for decompress (0 if unknown) */
  254.  unsigned short compressionSpeed;                    /* ( millisecs for compressing 320x240 on base mac II) (0 if unknown) */
  255.  unsigned short decompressionSpeed;                    /* ( millisecs for decompressing 320x240 on mac II)(0 if unknown) */
  256.  unsigned char compressionLevel;                    /* measure (1-255) of compression level of this codec (0 if unknown) */
  257.  char resvd;                                        /* pad */
  258.  short minimumHeight;                                /* minimum height of image (block size) */
  259.  short minimumWidth;                                /* minimum width of image (block size) */
  260.  short decompressPipelineLatency;                    /* in milliseconds ( for asynchronous codecs ) */
  261.  short compressPipelineLatency;                        /* in milliseconds ( for asynchronous codecs ) */
  262.  long privateData;
  263. };
  264.  
  265. typedef struct CodecInfo CodecInfo;
  266.  
  267. /* Table used for fast dithering. */
  268. struct DitherTable {
  269.  long tag;
  270.  long seed;
  271.  long reserved;
  272.  char data[1];
  273. };
  274.  
  275. typedef struct DitherTable DitherTable;
  276. typedef DitherTable *DTabPtr, **DTabHandle;
  277.  
  278. /* Name list returned by GetCodecNameList. */
  279. struct CodecNameSpec {
  280.  CodecComponent codec;
  281.  CodecType cType;
  282.  char typeName[32];
  283.  Handle name;
  284. };
  285.  
  286. typedef struct CodecNameSpec CodecNameSpec;
  287.  
  288. struct CodecNameSpecList {
  289.  short count;
  290.  CodecNameSpec list[1];
  291. };
  292.  
  293. typedef struct CodecNameSpecList CodecNameSpecList;
  294. typedef CodecNameSpecList *CodecNameSpecListPtr;
  295.  
  296. /*  Matrix stuff  */
  297. struct MatrixRecord {
  298.  Fixed matrix[3][3];
  299. };
  300.  
  301. typedef struct MatrixRecord  MatrixRecord;
  302. typedef MatrixRecord  *MatrixRecordPtr;
  303.  
  304. #ifndef _FixedPoint_
  305. #define _FixedPoint_
  306. struct FixedPoint {
  307.  Fixed x;
  308.  Fixed y;
  309. };
  310.  
  311. typedef struct FixedPoint FixedPoint;
  312. #endif _FixedPoint_
  313.  
  314. #ifndef _FixedRect_
  315. #define _FixedRect_
  316. struct FixedRect {
  317.  Fixed left;
  318.  Fixed top;
  319.  Fixed right;
  320.  Fixed bottom;
  321. };
  322.  
  323. typedef struct FixedRect FixedRect;
  324. #endif _FixedRect_
  325.  
  326.  
  327. #ifdef __cplusplus
  328. extern "C" {
  329. #endif
  330. pascal OSErr CodecManagerVersion(long *version)
  331.  = {0x7000,0xAAA3}; 
  332. pascal OSErr GetCodecNameList(CodecNameSpecListPtr *list,sBoolean showAll)
  333.  = {0x7001,0xAAA3};
  334. pascal OSErr DisposeCodecNameList(CodecNameSpecListPtr list)
  335.     = {0x700F,0xAAA3};
  336. pascal OSErr GetCodecInfo(CodecInfo *info,CodecType cType,CodecComponent codec)
  337.  = {0x7003,0xAAA3}; 
  338. pascal OSErr GetMaxCompressionSize(PixMapHandle src,const Rect *srcRect,short colorDepth,
  339.  CodecQ quality,CodecType cType,CompressorComponent codec,long *size)
  340.  = {0x7004,0xAAA3}; 
  341. pascal OSErr GetCompressionTime(PixMapHandle src,const Rect *srcRect,short colorDepth,
  342.  CodecType cType,CompressorComponent codec,CodecQ *spatialQuality,CodecQ *temporalQuality,
  343.  unsigned long *compressTime)
  344.  = {0x7005,0xAAA3}; 
  345. pascal OSErr CompressImage(PixMapHandle src,const  Rect *srcRect,CodecQ quality,
  346.  CodecType cType,ImageDescriptionHandle desc,Ptr data)
  347.  = {0x7006,0xAAA3}; 
  348. pascal OSErr FCompressImage(PixMapHandle src,const  Rect *srcRect,short colorDepth,
  349.  CodecQ quality,CodecType cType,CompressorComponent codec,CTabHandle clut,
  350.  CodecFlags flags,long bufferSize,FlushProcRecordPtr flushProc,ProgressProcRecordPtr progressProc,
  351.  ImageDescriptionHandle desc,Ptr data)
  352.  = {0x7007,0xAAA3}; 
  353. pascal OSErr DecompressImage(Ptr data,ImageDescriptionHandle desc,PixMapHandle dst,
  354.  const Rect *srcRect,const  Rect *dstRect,short mode,RgnHandle mask)
  355.  = {0x7008,0xAAA3}; 
  356. pascal OSErr FDecompressImage(Ptr data,ImageDescriptionHandle desc,PixMapHandle dst,
  357.  const  Rect *srcRect,MatrixRecordPtr matrix,short mode,RgnHandle mask,PixMapHandle matte,
  358.  const  Rect *matteRect,CodecQ accuracy,DecompressorComponent codec,long bufferSize,
  359.  DataProcRecordPtr dataProc,ProgressProcRecordPtr progressProc)
  360.  = {0x7009,0xAAA3}; 
  361. pascal OSErr CompressSequenceBegin(ImageSequence *seqID,PixMapHandle src,
  362.  PixMapHandle prev,const Rect *srcRect,const  Rect *prevRect,short colorDepth,CodecType cType,
  363.  CompressorComponent codec,CodecQ spatialQuality,CodecQ temporalQuality,
  364.  long keyFrameRate,CTabHandle clut,CodecFlags flags,ImageDescriptionHandle desc)
  365.  = {0x700A,0xAAA3}; 
  366. pascal OSErr CompressSequenceFrame(ImageSequence seqID,PixMapHandle src,
  367.  const Rect *srcRect,CodecFlags flags,Ptr data,long *dataSize,unsigned char *similarity,
  368.  CompletionProcRecordPtr asyncCompletionProc)
  369.  = {0x700B,0xAAA3}; 
  370. pascal OSErr DecompressSequenceBegin(ImageSequence *seqID,ImageDescriptionHandle desc,
  371.  CGrafPtr port,GDHandle gdh,const Rect *srcRect,MatrixRecordPtr matrix,short mode,
  372.  RgnHandle mask,CodecFlags flags,CodecQ accuracy,DecompressorComponent codec)
  373.  = {0x700D,0xAAA3}; 
  374. pascal OSErr DecompressSequenceFrame(ImageSequence seqID,Ptr data,CodecFlags inFlags,
  375.  CodecFlags *outFlags,CompletionProcRecordPtr asyncCompletionProc)
  376.  = {0x700E,0xAAA3}; 
  377. pascal OSErr SetDSequenceMatrix(ImageSequence seqID,MatrixRecordPtr matrix)
  378.  = {0x7010,0xAAA3}; 
  379. pascal OSErr SetDSequenceMatte(ImageSequence seqID,PixMapHandle matte,const Rect *matteRect)
  380.  = {0x7011,0xAAA3}; 
  381. pascal OSErr SetDSequenceMask(ImageSequence seqID,RgnHandle mask)
  382.  = {0x7012,0xAAA3}; 
  383. pascal OSErr SetDSequenceTransferMode(ImageSequence seqID,short mode,const RGBColor *opColor)
  384.  = {0x7013,0xAAA3}; 
  385. pascal OSErr SetDSequenceDataProc(ImageSequence seqID,DataProcRecordPtr dataProc,
  386.  long bufferSize)
  387.  = {0x7014,0xAAA3}; 
  388. pascal OSErr SetDSequenceAccuracy(ImageSequence seqID,CodecQ accuracy)
  389.  = {0x7034,0xAAA3}; 
  390. pascal OSErr SetDSequenceSrcRect(ImageSequence seqID,const Rect *srcRect)
  391.  = {0x7035,0xAAA3}; 
  392. pascal OSErr GetDSequenceImageBuffer(ImageSequence seqID,GWorldPtr *gworld)
  393.  = {0x7015,0xAAA3}; 
  394. pascal OSErr GetDSequenceScreenBuffer(ImageSequence seqID,GWorldPtr *gworld)
  395.  = {0x7016,0xAAA3}; 
  396. pascal OSErr SetCSequenceQuality(ImageSequence seqID,CodecQ spatialQuality,
  397.  CodecQ temporalQuality)
  398.  = {0x7017,0xAAA3}; 
  399. pascal OSErr SetCSequencePrev(ImageSequence seqID,PixMapHandle prev,const Rect *prevRect)
  400.  = {0x7018,0xAAA3}; 
  401. pascal OSErr SetCSequenceFlushProc(ImageSequence seqID,FlushProcRecordPtr flushProc,
  402.  long bufferSize)
  403.  = {0x7033,0xAAA3}; 
  404. pascal OSErr SetCSequenceKeyFrameRate(ImageSequence seqID,long keyframerate)
  405.  = {0x7036,0xAAA3}; 
  406. pascal OSErr GetCSequencePrevBuffer(ImageSequence seqID,GWorldPtr *gworld)
  407.  = {0x7019,0xAAA3}; 
  408. pascal OSErr CDSequenceBusy(ImageSequence seqID)
  409.  = {0x701A,0xAAA3}; 
  410. pascal OSErr CDSequenceEnd(ImageSequence seqID)
  411.  = {0x701B,0xAAA3}; 
  412. pascal OSErr GetCompressedImageSize(ImageDescriptionHandle desc,Ptr data,
  413.  long bufferSize,DataProcRecordPtr dataProc,long *dataSize)
  414.  = {0x701C,0xAAA3}; 
  415. pascal OSErr GetSimilarity(PixMapHandle src,const Rect *srcRect,ImageDescriptionHandle desc,
  416.  Ptr data,Fixed *similarity)
  417.  = {0x701D,0xAAA3}; 
  418. pascal OSErr GetImageDescriptionCTable(ImageDescriptionHandle desc,CTabHandle *ctable)
  419.  = {0x701E,0xAAA3}; 
  420. pascal OSErr SetImageDescriptionCTable(ImageDescriptionHandle desc,CTabHandle ctable)
  421.  = {0x701F,0xAAA3}; 
  422. pascal OSErr GetImageDescriptionExtension(ImageDescriptionHandle desc,Handle *extension,
  423.  long idType,long index)
  424.  = {0x7020,0xAAA3}; 
  425. pascal OSErr SetImageDescriptionExtension(ImageDescriptionHandle desc,Handle extension,
  426.  long idType)
  427.  = {0x7021,0xAAA3}; 
  428. pascal OSErr FindCodec(CodecType cType,CodecComponent specCodec,CompressorComponent *compressor,
  429.  DecompressorComponent *decompressor)
  430.  = {0x7023,0xAAA3}; 
  431. pascal OSErr CompressPicture(PicHandle srcPicture,PicHandle dstPicture,
  432.  CodecQ quality,CodecType cType)
  433.  = {0x7024,0xAAA3}; 
  434. pascal OSErr FCompressPicture(PicHandle srcPicture,PicHandle dstPicture,
  435.  short colorDepth,CTabHandle clut,CodecQ quality,sBoolean doDither,sBoolean compressAgain,
  436.  ProgressProcRecordPtr progressProc,CodecType cType,CompressorComponent codec)
  437.  = {0x7025,0xAAA3}; 
  438. pascal OSErr CompressPictureFile(short srcRefNum,short dstRefNum,CodecQ quality,
  439.  CodecType cType)
  440.  = {0x7026,0xAAA3}; 
  441. pascal OSErr FCompressPictureFile(short srcRefNum,short dstRefNum,short colorDepth,
  442.  CTabHandle clut,CodecQ quality,sBoolean doDither,sBoolean compressAgain,
  443.  ProgressProcRecordPtr progressProc,CodecType cType,CompressorComponent codec)
  444.  = {0x7027,0xAAA3}; 
  445. pascal OSErr GetPictureFileHeader(short refNum,Rect *frame,OpenCPicParams *header)
  446.  = {0x7028,0xAAA3}; 
  447. pascal OSErr DrawPictureFile(short refNum,const Rect *frame,ProgressProcRecordPtr progressProc)
  448.  = {0x7029,0xAAA3}; 
  449. pascal OSErr DrawTrimmedPicture(PicHandle srcPicture,const Rect *frame,RgnHandle trimMask,
  450.  sBoolean doDither,ProgressProcRecordPtr progressProc)
  451.  = {0x702E,0xAAA3}; 
  452. pascal OSErr DrawTrimmedPictureFile(short srcRefnum,const Rect *frame,RgnHandle trimMask,
  453.  sBoolean doDither,ProgressProcRecordPtr progressProc)
  454.  = {0x702F,0xAAA3}; 
  455. pascal OSErr MakeThumbnailFromPicture(PicHandle picture,short colorDepth,
  456.  PicHandle thumbnail,ProgressProcRecordPtr progressProc)
  457.  = {0x702A,0xAAA3}; 
  458. pascal OSErr MakeThumbnailFromPictureFile(short refNum,short colorDepth,
  459.  PicHandle thumbnail,ProgressProcRecordPtr progressProc)
  460.  = {0x702B,0xAAA3}; 
  461. pascal OSErr MakeThumbnailFromPixMap(PixMapHandle src,const Rect *srcRect,short colorDepth,
  462.  PicHandle thumbnail,ProgressProcRecordPtr progressProc)
  463.  = {0x702C,0xAAA3}; 
  464. pascal OSErr TrimImage(ImageDescriptionHandle desc,Ptr inData,long inBufferSize,
  465.  DataProcRecordPtr dataProc,Ptr outData,long outBufferSize,FlushProcRecordPtr flushProc,
  466.  Rect *trimRect,ProgressProcRecordPtr progressProc)
  467.  = {0x702D,0xAAA3}; 
  468. pascal OSErr ConvertImage(ImageDescriptionHandle srcDD,Ptr srcData,short colorDepth,
  469.  CTabHandle clut,CodecQ accuracy,CodecQ quality,CodecType cType,CodecComponent codec,
  470.  ImageDescriptionHandle dstDD,Ptr dstData)
  471.  = {0x7030,0xAAA3}; 
  472. pascal OSErr MakeDitherTable(GDHandle gdev,DTabHandle *ditherTable)
  473.  = {0x7031,0xAAA3}; 
  474. pascal OSErr DisposeDitherTable(DTabHandle ditherTable)
  475.  = {0x7032,0xAAA3}; 
  476.  
  477.  
  478. pascal void 
  479. StdPix(PixMapPtr src,const  Rect *srcRect,MatrixRecordPtr matrix,short mode,
  480.     RgnHandle mask,PixMapPtr matte,const Rect *matteRect,short flags)
  481.      = {0x700C,0xAAA3};
  482.  
  483. pascal OSErr GetCompressedPixMapInfo(PixMapPtr pix,ImageDescriptionHandle *desc,
  484.  Ptr *data,long *bufferSize,DataProcRecord *dataProc,ProgressProcRecord *progressProc)
  485.  = {0x7037,0xAAA3}; 
  486. pascal OSErr SetCompressedPixMapInfo(PixMapPtr pix,ImageDescriptionHandle desc,
  487.  Ptr data,long bufferSize,DataProcRecordPtr dataProc,ProgressProcRecordPtr progressProc)
  488.  = {0x7038,0xAAA3}; 
  489. pascal OSErr TransformRgn(MatrixRecordPtr mp,RgnHandle r)
  490.  = {0x7039,0xAAA3};
  491. #ifdef __cplusplus
  492. }
  493. #endif
  494. enum {
  495.  identityMatrixType            = 0x00,                         /* result if matrix is identity */
  496.  translateMatrixType        = 0x01,                         /* result if matrix translates */
  497.  scaleMatrixType            = 0x02,                         /* result if matrix scales */
  498.  scaleTranslateMatrixType    = 0x03,                         /* result if matrix scales and translates */
  499.  linearMatrixType            = 0x04,                         /* result if matrix is general 2 x 2 */
  500.  linearTranslateMatrixType    = 0x05,                         /* result if matrix is general 2 x 2 and translates */
  501.  perspectiveMatrixType        = 0x06                             /* result if matrix is general 3 x 3 */
  502. };
  503. typedef unsigned char MatrixFlags;
  504.  
  505.  
  506. #ifdef __cplusplus
  507. extern "C" {
  508. #endif
  509. pascal short GetMatrixType(MatrixRecordPtr m)
  510.  = {0x7014,0xABC2}; 
  511. pascal void CopyMatrix(MatrixRecordPtr m1,MatrixRecord *m2)
  512.  = {0x7020,0xABC2}; 
  513. pascal Boolean EqualMatrix(MatrixRecordPtr m1,MatrixRecordPtr m2)
  514.  = {0x7021,0xABC2}; 
  515. pascal void SetIdentityMatrix(MatrixRecord *matrix)
  516.  = {0x7015,0xABC2}; 
  517. pascal void TranslateMatrix(MatrixRecord *m,Fixed deltaH,Fixed deltaV)
  518.  = {0x7019,0xABC2}; 
  519. pascal void RotateMatrix(MatrixRecord *m,Fixed degrees,Fixed aboutX,Fixed aboutY)
  520.  = {0x7016,0xABC2}; 
  521. pascal void ScaleMatrix(MatrixRecord *m,Fixed scaleX,Fixed scaleY,Fixed aboutX,
  522.  Fixed aboutY)
  523.  = {0x7017,0xABC2}; 
  524. pascal void SkewMatrix(MatrixRecord *m,Fixed skewX,Fixed skewY,Fixed aboutX,
  525.  Fixed aboutY)
  526.  = {0x7018,0xABC2}; 
  527. pascal OSErr TransformFixedPoints(MatrixRecordPtr m,FixedPoint *fpt,long count)
  528.  = {0x7022,0xABC2}; 
  529. pascal OSErr TransformPoints(MatrixRecordPtr mp,Point *pt1,long count)
  530.  = {0x7023,0xABC2}; 
  531. pascal Boolean TransformFixedRect(MatrixRecordPtr m,FixedRect *fr,FixedPoint *fpp)
  532.  = {0x7024,0xABC2}; 
  533. pascal Boolean TransformRect(MatrixRecordPtr m,Rect *r,FixedPoint *fpp)
  534.  = {0x7025,0xABC2}; 
  535. pascal Boolean InverseMatrix(MatrixRecordPtr m,MatrixRecord *im)
  536.  = {0x701C,0xABC2}; 
  537. pascal void ConcatMatrix(MatrixRecordPtr a,MatrixRecord *b)
  538.  = {0x701B,0xABC2}; 
  539. pascal void RectMatrix(MatrixRecord *matrix,Rect *srcRect,Rect *dstRect)
  540.  = {0x701E,0xABC2}; 
  541. pascal void MapMatrix(MatrixRecord *matrix,Rect *fromRect,Rect *toRect)
  542.  = {0x701D,0xABC2}; 
  543. #ifdef __cplusplus
  544. }
  545. #endif
  546.  
  547. #ifdef __cplusplus
  548. extern "C" {
  549. #endif
  550.  
  551. /*  Standard Preview */
  552.  
  553. pascal void SFGetFilePreview(Point where,
  554.                       ConstStr255Param prompt,
  555.                       FileFilterProcPtr fileFilter,
  556.                       short numTypes,
  557.                       SFTypeList typeList,
  558.                       DlgHookProcPtr dlgHook,
  559.                       SFReply *reply)
  560.  = {0x303C,65,0xAAA3}; 
  561.  
  562. pascal void SFPGetFilePreview(Point where,
  563.                        ConstStr255Param prompt,
  564.                        FileFilterProcPtr fileFilter,
  565.                        short numTypes,
  566.                        SFTypeList typeList,
  567.                        DlgHookProcPtr dlgHook,
  568.                        SFReply *reply,
  569.                        short dlgID,
  570.                        ModalFilterProcPtr filterProc)
  571.  = {0x303C,66,0xAAA3}; 
  572.  
  573. pascal void StandardGetFilePreview(FileFilterProcPtr fileFilter,
  574.                             short numTypes,
  575.                             SFTypeList typeList,
  576.                             StandardFileReply *reply)
  577.  = {0x303C,67,0xAAA3}; 
  578.  
  579. pascal void CustomGetFilePreview(FileFilterYDProcPtr fileFilter,
  580.                           short numTypes,
  581.                           SFTypeList typeList,
  582.                           StandardFileReply *reply,
  583.                           short dlgID,
  584.                           Point where,
  585.                           DlgHookYDProcPtr dlgHook,
  586.                           ModalFilterYDProcPtr filterProc,
  587.                           short *activeList,
  588.                           ActivateYDProcPtr activateProc,
  589.                           void *yourDataPtr)
  590.  = {0x303C,68,0xAAA3}; 
  591.  
  592. pascal OSErr MakeFilePreview(short resRefNum, ProgressProcRecordPtr progress)
  593.  = {0x303C,69,0xAAA3}; 
  594.  
  595. pascal OSErr AddFilePreview(short resRefNum, OSType previewType, Handle previewData)
  596.  = {0x303C,70,0xAAA3}; 
  597.  
  598. #ifdef __cplusplus
  599. }
  600. #endif
  601.  
  602. enum {
  603.     sfpItemPreviewAreaUser = 11,
  604.     sfpItemPreviewStaticText = 12,
  605.     sfpItemPreviewDividerUser = 13,
  606.     sfpItemCreatePreviewButton = 14,
  607.     sfpItemShowPreviewButton = 15
  608. };
  609.  
  610. struct PreviewResourceRecord {
  611.     unsigned long    modDate;
  612.     short            version;
  613.     OSType            resType;
  614.     short            resID;
  615. };
  616.  
  617. typedef struct PreviewResourceRecord PreviewResourceRecord;
  618. typedef PreviewResourceRecord *PreviewResourcePtr, **PreviewResource;
  619.  
  620. #endif
  621.